<html>
<head><meta charset="utf-8"><title>using annotate-snippets-rs · t-compiler/wg-diagnostics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/index.html">t-compiler/wg-diagnostics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html">using annotate-snippets-rs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="160350322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/160350322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Manish Goregaokar <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#160350322">(Mar 09 2019 at 04:42)</a>:</h4>
<p>Hey, so a colleague of mine wrote <a href="https://crates.io/crates/annotate-snippets" target="_blank" title="https://crates.io/crates/annotate-snippets">https://crates.io/crates/annotate-snippets</a> for formatting rustc-like diagnostics output. Do y'all think we should try to polish that up and use it as a crate directly? IIRC it's more or less feature compatible with the current diagnostics formatting. Would be nice to move code out of tree.</p>
<p>cc <span class="user-mention" data-user-id="119031">@Esteban Küber</span> <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="160350343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/160350343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Manish Goregaokar <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#160350343">(Mar 09 2019 at 04:43)</a>:</h4>
<p><a href="https://www.reddit.com/r/rust/comments/aydqwr/roadmap_rfc_for_2019/" target="_blank" title="https://www.reddit.com/r/rust/comments/aydqwr/roadmap_rfc_for_2019/">https://www.reddit.com/r/rust/comments/aydqwr/roadmap_rfc_for_2019/</a></p>



<a name="160352743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/160352743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#160352743">(Mar 09 2019 at 05:54)</a>:</h4>
<p>I'll take a look at it</p>



<a name="160352806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/160352806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#160352806">(Mar 09 2019 at 05:56)</a>:</h4>
<p>Is he interested in catering to our use case? I was thinking we'd end up extracting the existing machinery out into a crate</p>



<a name="166334553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166334553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166334553">(May 23 2019 at 05:48)</a>:</h4>
<p>I'm currently looking for a way to split this up into smaller parts. I would really like to work on this, but I don't have enough free time to do it all at once</p>



<a name="166523336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166523336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166523336">(May 25 2019 at 11:29)</a>:</h4>
<p>ok, using a new <code>error-format</code> and a separate <code>EmitterWriter</code> I can now successfully print <em>nothing</em> instead of the human output</p>



<a name="166523338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166523338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166523338">(May 25 2019 at 11:29)</a>:</h4>
<p>I'm not sure if it makes sense to open a PR for just this, so I'll continue and try to get at least <em>some</em> output using annotate-rs</p>



<a name="166531765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166531765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166531765">(May 25 2019 at 15:26)</a>:</h4>
<p>heh, we should do $something at least. Like even just dump the main diagnostic message at file:1:1</p>



<a name="166531811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166531811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166531811">(May 25 2019 at 15:26)</a>:</h4>
<p>(via annotate-rs)</p>



<a name="166531814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166531814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166531814">(May 25 2019 at 15:26)</a>:</h4>
<p>at that point I'd be fine with merging so further development can continue without having to do all the boilerplate or bitrotting cleanup</p>



<a name="166686754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166686754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166686754">(May 28 2019 at 06:22)</a>:</h4>
<p>Quick update: <a href="https://github.com/rust-lang/rust/issues/61191" target="_blank" title="https://github.com/rust-lang/rust/issues/61191">#61191</a> is a first refactoring extraction from the things I'm doing. I'm currently figuring out how to get the diagnostic code lines for each emitted diagnostic. Once that's done I'll open up a PR with the initial work.</p>



<a name="166686922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166686922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166686922">(May 28 2019 at 06:26)</a>:</h4>
<p>The nice thing about using annotate-rs is that it forces us to separate the diagnostics data collection from the rendering. The current code is  ..a good refactoring challenge <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="166686933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/166686933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#166686933">(May 28 2019 at 06:26)</a>:</h4>
<p>I don't know if it will have performance implications, though</p>



<a name="167030465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/167030465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#167030465">(May 31 2019 at 20:16)</a>:</h4>
<p>Initial PR is up: <a href="https://github.com/rust-lang/rust/pull/61407" target="_blank" title="https://github.com/rust-lang/rust/pull/61407">https://github.com/rust-lang/rust/pull/61407</a></p>



<a name="167378284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/167378284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#167378284">(Jun 05 2019 at 11:18)</a>:</h4>
<p>Now that the initial PR is merged, I want to do some small cleanups</p>



<a name="167378294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/167378294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#167378294">(Jun 05 2019 at 11:18)</a>:</h4>
<p>after that I think we can turn <a href="https://github.com/rust-lang/rust/issues/59346" target="_blank" title="https://github.com/rust-lang/rust/issues/59346">https://github.com/rust-lang/rust/issues/59346</a> into a tracking issue and create new issues for the various FIXMEs. what do you think?</p>



<a name="167378454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/167378454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#167378454">(Jun 05 2019 at 11:21)</a>:</h4>
<p>i.e. </p>
<ul>
<li>suggestion support</li>
<li><code>LL</code> line numbers support in <code>annotate-snippet</code> for <code>-Z ui-testing</code></li>
<li>proper handling of macros</li>
<li>different output 'destinations', like in the current emitter</li>
<li>etc</li>
</ul>



<a name="167378570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/167378570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#167378570">(Jun 05 2019 at 11:23)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="168075905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/168075905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#168075905">(Jun 13 2019 at 19:08)</a>:</h4>
<p>I hope to have the separate issues for actionable tasks created today</p>



<a name="168075928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/168075928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#168075928">(Jun 13 2019 at 19:08)</a>:</h4>
<p>I'm don't think that FIXMEs that require further investigation should get their own issues already</p>



<a name="168076003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/168076003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#168076003">(Jun 13 2019 at 19:09)</a>:</h4>
<p>For example <a href="https://github.com/rust-lang/rust/blob/57a3300c2538fd1044ce45d9ef3b82182acb57ae/src/librustc_errors/annotate_snippet_emitter_writer.rs#L118" target="_blank" title="https://github.com/rust-lang/rust/blob/57a3300c2538fd1044ce45d9ef3b82182acb57ae/src/librustc_errors/annotate_snippet_emitter_writer.rs#L118">https://github.com/rust-lang/rust/blob/57a3300c2538fd1044ce45d9ef3b82182acb57ae/src/librustc_errors/annotate_snippet_emitter_writer.rs#L118</a> is not really worth it's own issue but should be investigated at some point</p>



<a name="168132529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/168132529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#168132529">(Jun 14 2019 at 12:59)</a>:</h4>
<p>^ Created <a href="https://github.com/rust-lang/rust/issues/61809" target="_blank" title="https://github.com/rust-lang/rust/issues/61809">#61809</a> <a href="https://github.com/rust-lang/rust/issues/61810" target="_blank" title="https://github.com/rust-lang/rust/issues/61810">#61810</a> and <a href="https://github.com/rust-lang/rust/issues/61811" target="_blank" title="https://github.com/rust-lang/rust/issues/61811">#61811</a></p>



<a name="172745478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/172745478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#172745478">(Aug 08 2019 at 07:50)</a>:</h4>
<p>It's been two months and <a href="https://github.com/rust-lang/rust/issues/61811" target="_blank" title="https://github.com/rust-lang/rust/issues/61811">#61811</a> is done now; I wish I had more time to work on both Clippy and rustc diagnostics <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="172745506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/147480-t-compiler/wg-diagnostics/topic/using%20annotate-snippets-rs/near/172745506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Phil H <a href="https://rust-lang.github.io/zulip_archive/stream/147480-t-compiler/wg-diagnostics/topic/using.20annotate-snippets-rs.html#172745506">(Aug 08 2019 at 07:51)</a>:</h4>
<p>I want to get back to the other two issues by end of August, unless someone else wants to have a go at them</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>